﻿Public Class GestionComptes

    Private Sub Expander_Collapsed(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles Expander.Collapsed
        mainGrid.ColumnDefinitions(2).Width = New Windows.GridLength(0, Windows.GridUnitType.Auto)
    End Sub

    Private Sub postesDGrid_InitializingNewItem(ByVal sender As Object, ByVal e As System.Windows.Controls.InitializingNewItemEventArgs) Handles postesDGrid.InitializingNewItem
        Dim rv As Data.DataRowView = e.NewItem

        rv("ID") = "POSTE" & (rv.DataView.Count).ToString("0000")
    End Sub

    
    Private Sub comptesDGrid_InitializingNewItem(ByVal sender As Object, ByVal e As System.Windows.Controls.InitializingNewItemEventArgs) Handles comptesDGrid.InitializingNewItem
        Dim rv As Data.DataRowView = e.NewItem

        rv("ID") = "COMPTE" & (rv.DataView.Count).ToString("000")
    End Sub
End Class

Public Class GestionComptesIDPosteToNomPosteConverter
    Implements Windows.Data.IValueConverter


    Public Function Convert(ByVal value As Object, ByVal targetType As System.Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Implements System.Windows.Data.IValueConverter.Convert
        Dim rv As System.Data.DataRowView = value

        Return rv.Row.GetParentRow("REL_POSTE_DESC")("NOM")
    End Function

    Public Function ConvertBack(ByVal value As Object, ByVal targetType As System.Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Implements System.Windows.Data.IValueConverter.ConvertBack

    End Function
End Class
Public Class GestionComptesPotsteRowToVisibilityConverter
    Implements Windows.Data.IValueConverter


    Public Function Convert(ByVal value As Object, ByVal targetType As System.Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Implements System.Windows.Data.IValueConverter.Convert
        Dim r As Boolean = value

        Return If(r, Windows.Visibility.Visible, Windows.Visibility.Hidden)
       
    End Function

    Public Function ConvertBack(ByVal value As Object, ByVal targetType As System.Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Implements System.Windows.Data.IValueConverter.ConvertBack

    End Function
End Class